<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h3>lazy修饰符</h3>
      <!-- lazy内容改变并且失去焦点再触发 -->
      <input type="text" v-model.lazy="text1" />
      <span>{{ text1 }}</span>

      <h3>number修饰符</h3>
      <!-- number修饰符就是将内容尝试转成数字类型 -->
      <!-- 在vue3中，只要加了type="number",就会默认加上.number -->
      <input type="number" v-model.number="text2" />
      <span>{{ text2 }} - {{ typeof text2 }}</span>

      <h3>trim修饰符</h3>
      <!-- trim修饰符用于去除收尾空格 -->
      <input type="text" v-model.trim="text3" />
      <span>{{ text3 }}</span>
      <button @click="fn">btn</button>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      Vue.createApp({
        data() {
          return {
            text1: "111",
            text2: 123,
            text3: "",
          };
        },
        methods: {
          fn() {
            console.log(this.text3);
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
